<?php /* @var $this Controller */ ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="language" content="en" />

    <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,600,700' rel='stylesheet' type='text/css'>

    <?php
    $baseUrl = Yii::app()->baseUrl;
    $cs = Yii::app()->getClientScript();


    //********************//
    //**** JAVASCRIPT ****//
    //********************//

    $cs->registerCoreScript('jquery');
    $cs->registerScriptFile($baseUrl.'/libraries/tinymce/tinymce.min.js');
    $cs->registerScriptFile($baseUrl.'/js/protected-form.js');


    //*************//
    //**** CSS ****//
    //*************//

    //** Glyphicons
    $cs->registerCssFile($baseUrl.'/libraries/glyphicons/css/glyphicons.css');

    //** IcoMoon
    $cs->registerCssFile($baseUrl.'/libraries/icomoon/icomoon.css');

    //** Core
    $cs->registerCssFile($baseUrl.'/css/core/reset.css');
    $cs->registerCssFile($baseUrl.'/css/core/layout.css');
    $cs->registerCssFile($baseUrl.'/css/core/style.css');
    $cs->registerCssFile($baseUrl.'/css/core/toolbar.css');
    $cs->registerCssFile($baseUrl.'/css/core/form.css');

    //** Widgets
    $cs->registerCssFile($baseUrl.'/css/widgets/superfish.css');
    $cs->registerCssFile($baseUrl.'/css/widgets/gridview.css');
    $cs->registerCssFile($baseUrl.'/css/widgets/detailview.css');
    $cs->registerCssFile($baseUrl.'/css/widgets/listview.css');
    $cs->registerCssFile($baseUrl.'/css/widgets/pager.css');
    $cs->registerCssFile($baseUrl.'/css/widgets/chosen.css');

    //** Views
    //if(file_exists($baseUrl.$this->view_css))
    $cs->registerCssFile($baseUrl.$this->view_css);

    ?>

	<title><?php echo CHtml::encode($this->pageTitle); ?></title>

    <script>
        tinymce.init({
                selector:'.html-editor',
                height : 150,
                menubar : false,
                statusbar : false,
                toolbar: "undo redo | bold italic underline | bullist numlist outdent indent | cut copy paste",
                setup : function(ed) {
                    ed.on('change', function(e) {
                        $("form").change();
                    });
                }
        });
    </script>

    <script type="text/javascript">
        $(document).ready( function() {
            $('.flash').delay(2500).fadeOut();
        });
    </script>

</head>


<body>



<div id="wrapper">


      <div id="header" class="main-background">

          <div id="header-left">
          <h1 class="page-title">
              <a class="home-button icon icon-basketball titlebar-logo-white"></a>
              <b>BCAPP 1.0</b>
              <?php if($this->section!="") { echo " - ".$this->section;} ?>
          </h1>
          </div>

          <div id="header-right">

              <?php
              $url = $this->createUrl("site/logout");
              echo '<a href="'.$url.'" class="header-button icon icon-exit3 titlebar-white">Logout</a>';
              ?>

              <?php
              $url = $this->createUrl("user/updateuserprofile");
              echo '<a href="'.$url.'" class="header-button icon icon-profile titlebar-white">My Account</a>';
              ?>

              <?php
              $url = $this->createUrl("site/help");
              echo '<a href="'.$url.'" class="header-button icon icon-question4 titlebar-white">Help</a>';
              ?>

          </div>

      </div>



    <div class="clear"></div>
    <div id="topmenu" class="menu-background">

        <div id="topmenu-left" class="left">
            <?php $this->widget('ext.CDropDownMenu.CDropDownMenu',array(
                'items'=>array(
                    array('label'=>'Drills',
                        'items'=>array(
                            array('label'=>'New Drill', 'url'=>array('/drill/create'),'linkOptions'=>array('class'=>'icon icon-stack-plus menu-gray')),
                            array('label'=>'Drills Library', 'url'=>array('/drill/list'),'linkOptions'=>array('class'=>'icon icon-books menu-gray')),
                            array('label'=>'My Drills', 'url'=>array('/drill/admin'),'linkOptions'=>array('class'=>'icon icon-traffic-cone menu-gray')),
                        )
                    ),
                    array('label'=>'Teams',
                        'items'=>array(
                            array('label'=>'New Team', 'url'=>array('/team/create'),'linkOptions'=>array('class'=>'icon icon-stack-plus menu-gray')),
                            array('label'=>'Manage Teams', 'url'=>array(''),'linkOptions'=>array('class'=>'icon icon-users2 menu-gray')),
                        )
                    ),
                    array('label'=>'Practices',
                        'items'=>array(
                            array('label'=>'New Practice', 'url'=>array(''),'linkOptions'=>array('class'=>'icon icon-stack-plus menu-gray')),
                            array('label'=>'My Practices', 'url'=>array(''),'linkOptions'=>array('class'=>'icon icon-design menu-gray')),
                            array('label'=>'Shared Practices', 'url'=>array(''),'linkOptions'=>array('class'=>'icon icon-share3 menu-gray')),
                        )
                    ),

                ),

                'encodeLabel' => false,
            )); ?>
        </div>


        <div id="topmenu-right" class="right">
            <?php $this->widget('ext.CDropDownMenu.CDropDownMenu',array(
                'items'=>array(
                    array('label'=>'Administration',
                        'items'=>array(
                            array('label'=>'Manage Users', 'url'=>array('/user/admin'),'linkOptions'=>array('class'=>'icon icon-users menu-gray')),
                            array('label'=>'Manage Categories', 'url'=>array('/drillCategory/admin'),'linkOptions'=>array('class'=>'icon icon-folder3 menu-gray')),
                            array('label'=>'Manage Tags', 'url'=>array('/tag/admin'),'linkOptions'=>array('class'=>'icon icon-price-tag4 menu-gray')),
                            array('label'=>'Manage Drills', 'url'=>array('/drill/admin'),'linkOptions'=>array('class'=>'icon icon-traffic-cone menu-gray')),
                            array('label'=>'View Logs', 'url'=>array('/logs/admin'),'linkOptions'=>array('class'=>'icon icon-book menu-gray')),
                        )
                    ),
                ),
                'encodeLabel' => false,
            )); ?>

        </div>


    </div><!-- mainmenu -->


      <div class="clear"></div>

      <div id="toolbar">
      <?php
      $this->beginWidget('zii.widgets.CPortlet', array());
      $this->widget('zii.widgets.CMenu', array(
          'items'=>$this->menu,
          'htmlOptions'=>array('class'=>'operations'),
          'encodeLabel' => false,
      ));
      $this->endWidget();
      ?>
      </div>

      <div class="clear"></div>

    <div id="content" class="content-background">

    <?php
        foreach(Yii::app()->user->getFlashes() as $key => $message) {
            echo '<div class="flash flash-' . $key . '"><img src="images/flash-'.$key.'.png"><p><b>'. strtoupper($key) . ':</b> ' . $message . "</p></div>\n";
        }
    ?>

        <div class="clear"></div>

        <?php echo $content; ?>
    </div>

    <div class="clear"></div>

</div><!-- wrapper -->

</body>
</html>
